<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>充值</title>
		<script type="text/javascript" src="./js/jquery-1.11.3.min.js"></script>
		<style type="text/css">
		</style>
	</head>
	<style type="text/css">
		body{
			padding: 0;
			margin: 0;
			width: 100%;
			height: 100%;
		}
		#text{
			display: flex;
			justify-content: center;
			align-items: center;
			width: 100vw;
			height: 100vh;
			
		}
	</style>
	<body>
		<div id="text">
			<span>充值跳转等待中...</span>
		</div>
		<form id="forms"  method="post">
			<input type="submit" style="visibility: hidden;"/>
		</form>
		
	</body>
</html>
<script>
	let newData = JSON.parse(getQuery('data'))
	$("#forms").attr("action",newData.url+'?token='+newData.token.split(" ")[1])
	$("#forms").append($("<input></input>").attr("type", "hidden").attr("name", "pay_type").attr("value", newData.pay_type));
	$("#forms").append($("<input></input>").attr("type", "hidden").attr("name", "product_integral_id").attr("value", newData.product_integral_id));
	$("#forms").append($("<input></input>").attr("type", "hidden").attr("name", "success_url").attr("value", newData.success_url));
	$("#forms").submit()
	//取url中的参数值
	function getQuery(name) {
		// 正则：[找寻'&' + 'url参数名字' = '值' + '&']（'&'可以不存在）
		let reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
		let r = window.location.search.substr(1).match(reg);
		if(r != null) {
			// 对参数值进行解码
			return decodeURIComponent(r[2]);
		}
		return null;
	}
	
</script>